import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:xin_he/utils/xh_styles.dart';
import 'package:xin_he/utils/xin_he_user_data.dart';

import '../../../routes/xin_he_routes.dart';
import '../../../utils/xin_he_image.dart';
import 'xin_he_my_qr_code_logic.dart';

class XinHeMyQrCodePage extends StatelessWidget {
  XinHeMyQrCodePage({Key? key}) : super(key: key);

  final logic = Get.put(XinHeMyQrCodeLogic());
  final state = Get.find<XinHeMyQrCodeLogic>().state;

  @override
  Widget build(BuildContext context) {
    return  Center(
      child: Container(
        width: Get.width-43*2,
        height: 318/289.0*(Get.width-43*2),
        margin: const EdgeInsets.symmetric(horizontal: 43),
        decoration: BoxDecoration(color: XinHeColor('#80EAEA'),borderRadius: BorderRadius.circular(10)),
        padding: const EdgeInsets.all(20),
        alignment: Alignment.center,
        child: Container(
          color: Colors.white,
          height: 318/289*(Get.width-43*2)-20*2,
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            children: [
              const SizedBox(height: 20,),
              ///头像 昵称
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  ///头像
                  ClipRRect(
                    borderRadius: BorderRadius.circular(25.5),
                    child: xinHeUserData.appLoginState.value? XinHeNetImage(url: xinHeUserData.userDetailInfo.value?.iconPath??'',width: 51,height: 51,fit: BoxFit.cover,): const XinHeAssetImage('assets/images/mine/default_avatar.png',width: 51,height: 51,),

                  ),
                  const SizedBox(width: 10,),
                  ///姓名
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Text( xinHeUserData.userDetailInfo.value?.name??'',style: TextStyle(color: XinHeColor('#222222'),fontSize: 15,fontWeight: FontWeight.w600),),
                      const SizedBox(height: 6,),
                      const XinHeAssetImage('assets/images/mine/vip.png',width: 60,height: 18,),

                    ],),
                ],),
              const SizedBox(height: 20,),
              QrImageView(data: xinHeUserData.userDetailInfo.value?.code??'',size: 152,)
            ],),
        ),
      ),);
  }
}
